import 'dart:async';

import 'package:flutter/material.dart';
import 'package:xxx_app/constants.dart';
import 'package:fluro/fluro.dart';
import 'package:logging/logging.dart';


import 'package:xxx_app/src/config/application.dart';
import 'package:xxx_app/src/main_tabbar.dart';
import 'package:xxx_app/src/routes.dart';

final _logger = new Logger('splash ');

class SplashScreen extends StatefulWidget {
  @override
  _SplashScreenState createState() => _SplashScreenState();
}

class _SplashScreenState extends State<SplashScreen> {

  void countDown() {
    
  }
  
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    _logger.finest(" -------- ======= ---- - wwwwwww ");

    Timer(
      Duration(seconds: 3), 
      () {
        _logger.finest(" -------- ======= ---- - eeeeeeee ");

        showHome();
      }
    );

  }

  @override
  void didUpdateWidget(SplashScreen oldWidget) {
    // TODO: implement didUpdateWidget
    super.didUpdateWidget(oldWidget);
    _logger.finest(" -------- ======= ---- - 1111 ");

  }

  @override
  void didChangeDependencies() {
    // TODO: implement didChangeDependencies
    super.didChangeDependencies();
    _logger.finest(" -------- ======= ---- - 2222 ");

  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(

      body: SafeArea(
        child: Container(

          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              
              Container(
                child: Center(
                   child: Image.asset("assets/images/common/app_logo.png"),
                ),
              )

            ],
          ),


          ),
        ),
        floatingActionButton: FloatingActionButton(
          tooltip: 'skip',
          onPressed: () {
            showHome();
          },
          child: Text(
            'skip',
          ),
          backgroundColor: Color(AppColors.primaryColor),

        ),
      
    );
  }

  void showHome() {
    _logger.finest(" ---- 00000000 -------- 000 ");
    Application.router.navigateTo(context, AppRoutes.root, replace: true, transition: TransitionType.fadeIn, transitionDuration: Duration(milliseconds: 400));

  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();

  }

  
}